//
//  PurchaseWordsCell.m
//  yigou
//
//  Created by wangdianlei on 2017/1/13.
//  Copyright © 2017年 hanyiwang. All rights reserved.
//

#import "PurchaseWordsCell.h"

@implementation PurchaseWordsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    if (!_textview) {
        _textview = [[SZTextView alloc] init];
        _textview.frame = CGRectMake(10, 10, ScreenWidth - 20, 100);
        _textview.font = [UIFont systemFontOfSize:14];
        //_textview.text = @"最困难的时候，也就是我们离成功不远的时候。";
        _textview.placeholder = @"给卖家留言";
        [self addSubview:_textview];
        _textview.delegate = self;
        
        [_textview.layer setBorderWidth:1];
        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
        CGColorRef colorref = CGColorCreate(colorSpace, (CGFloat[]){0.8, 0.8, 0.8, 1});
        [_textview.layer setBorderColor:colorref];
        CGColorRelease(colorref);
        CGColorSpaceRelease(colorSpace);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)textViewDidChange:(UITextView *)textView {
    [DataCenter sharedDataCenter].purchaseWords = textView.text;
}

@end
